package com.jic.order.api;

import com.jic.common.base.vo.RestResult;
import com.jic.order.manage.response.OrderResponse;
import com.jic.order.response.HotProductResponse;
import com.jic.order.response.OrderGoodsResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.List;

/**
 * description: 订单提供给商品服务内部调用类
 *
 * @author: jackHe
 * @time: 2020/8/8 14:49
 */
@FeignClient(name = "jic-order", path = "/feign/product")
public interface ProductApi {

	/**
	 * description: 根据商品ID查询商品销量
	 *
	 * @author: jackHe
	 * @time: 2020/8/8 14:12
	 */
	@PostMapping("/queryProductSalesByProductID")
	RestResult<Integer> queryProductSalesByProductId(@RequestBody List<Long> productIds);

	/**
	 * description: 查询TOP8商品和销量
	 *
	 * @author: jackHe
	 * @time: 2020/8/12 12:46
	 */
	@PostMapping("/queryHotProduct")
	RestResult<List<HotProductResponse>> queryHotProduct();

	/**
	 * 根据商品code查询订单数量
	 * @param
	 * @return
	 */
	@ApiOperation(value = "查询商品对应的订单信息")
	@RequestMapping(value = "/queryBycommodityCode",method =RequestMethod.GET)
	List<OrderResponse> queryBycommodityCode(@RequestParam("code")String code,@RequestParam("settStartTime")String settStartTime,@RequestParam("settEndTime")String settEndTime) throws ParseException;


	@ApiOperation(value = "查询商品对应的订单数量商品数量信息")
	@RequestMapping(value = "/queryBycommodityCodeNumber",method =RequestMethod.GET)
	List<OrderResponse> queryBycommodityCodeNumber(@RequestParam("commodityCode") String commodityCode, @RequestParam("settStartTime") String settStartTime , @RequestParam("settEndTime") String  settEndTime) throws ParseException;


	@ApiOperation(value = "根据订单编号和商品code查询商品订单明细信息")
	@RequestMapping("/queryByOrderNoAndGoodsCode")
	List<OrderGoodsResponse> queryByOrderNoAndGoodsCode(@RequestParam("commodityCode") String commodityCode, @RequestParam("orderNo") String orderNo);


}
